package com.edu.study.base.lmsOrder.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.edu.study.base.lmsOrder.domain.LmsOrder;
import com.edu.study.base.lmsOrder.service.ILmsOrderService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * lmsOrderController
 * 
 * @author zw
 * @date 2021-08-11
 */
@RestController
@RequestMapping("/lmsOrder/lmsOrder")
public class LmsOrderController extends BaseController
{
    @Autowired
    private ILmsOrderService lmsOrderService;

    /**
     * 查询lmsOrder列表
     */
    @PreAuthorize("@ss.hasPermi('lmsOrder:lmsOrder:list')")
    @GetMapping("/list")
    public TableDataInfo list(LmsOrder lmsOrder)
    {
        startPage();
        List<LmsOrder> list = lmsOrderService.selectLmsOrderList(lmsOrder);
        return getDataTable(list);
    }

    /**
     * 导出lmsOrder列表
     */
    @PreAuthorize("@ss.hasPermi('lmsOrder:lmsOrder:export')")
    @Log(title = "lmsOrder", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(LmsOrder lmsOrder)
    {
        List<LmsOrder> list = lmsOrderService.selectLmsOrderList(lmsOrder);
        ExcelUtil<LmsOrder> util = new ExcelUtil<LmsOrder>(LmsOrder.class);
        return util.exportExcel(list, "lmsOrder");
    }

    /**
     * 获取lmsOrder详细信息
     */
    @PreAuthorize("@ss.hasPermi('lmsOrder:lmsOrder:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(lmsOrderService.selectLmsOrderById(id));
    }

    /**
     * 新增lmsOrder
     */
    @PreAuthorize("@ss.hasPermi('lmsOrder:lmsOrder:add')")
    @Log(title = "lmsOrder", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LmsOrder lmsOrder)
    {
        return toAjax(lmsOrderService.insertLmsOrder(lmsOrder));
    }

    /**
     * 修改lmsOrder
     */
    @PreAuthorize("@ss.hasPermi('lmsOrder:lmsOrder:edit')")
    @Log(title = "lmsOrder", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LmsOrder lmsOrder)
    {
        return toAjax(lmsOrderService.updateLmsOrder(lmsOrder));
    }

    /**
     * 删除lmsOrder
     */
    @PreAuthorize("@ss.hasPermi('lmsOrder:lmsOrder:remove')")
    @Log(title = "lmsOrder", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(lmsOrderService.deleteLmsOrderByIds(ids));
    }
}
